layui.use(['form','laydate'],function (){
    var form = layui.form;
    var laydate = layui.laydate;

    //日期时间选择器
    laydate.render({
        elem: '#startTime'
        ,type: 'datetime'
    });
    //日期时间选择器
    laydate.render({
        elem: '#endTime'
        ,type: 'datetime'
    });

    $("#demo2").on('click',function (){
        let val = form.val("example");
        console.log(val);
        addCoup(val);
        return false;
    })

})

function qx(){

        //关闭弹框
        let index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index); //再执行关闭

        // 刷新父页面的table表格
        parent.refasehCou();
}

function addCoup(d){
    console.log(d);
    $.ajax({
        type:'post',
        url:'/Primary/addCoup',
        data:d,
        dataType:'json',
        success:function (){
            //关闭弹框
            let index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index); //再执行关闭

            // 刷新父页面的table表格
            parent.refasehCou();
        },error:function (){

        }
    })
}